/**
 * 用户接口
 */

import { Get, Post, Delete, RequestParams, ResponseData } from '../../common/decorator'


export default class LoginService {

  /**
   * 登录方法
   * @param res 
   * @returns 
   */
  @Post("/auth/login", { headers: { isToken: false }, requestType: 'data' })
  login(res: object) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  /**
   * 注册方法
   * @param res 
   * @returns 
   */
  @Post("/auth/register", { headers: { isToken: false }, requestType: 'data' })
  register(res: object) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  /**
   * 刷新token
   * @param res 
   * @returns 
   */
  @Post("/auth/refresh")
  refreshToken(res: void) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  /**
   * 获取用户详细信息
   * @param res 
   * @returns 
   */
  @Get("/system/user/getInfo")
  getInfo(res: void) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<any>
  }

  /**
   * 登出
   * @param res 
   * @returns 
   */
  @Delete("/auth/logout")
  logout(res: void) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  /**
   * 获取验证码
   * @param res 
   * @returns 
   */
  @Get("/code", { headers: { isToken: false }, requestType: 'params' })
  getCodeImg(res: void) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<any>
  }
}